<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>加油优惠价格计算</title>
</head>

<body>
    <script type="text/javascript">
        var gasoline = prompt("请输入汽油编号");
        var litre = prompt("请输入你要加多少升");
        var price;
        if (parseFloat(gasoline) == 92) {
            if (litre < 20) {
                price = parseFloat(litre) * 6;
                document.write('汽油6元一升;' + '<br/>');
                document.write('共计:' + price + '元')
            } else {
                price = parseFloat(litre) * 5.9;
                document.write('汽油5.9元一升;' + '<br/>');
                document.write('共计:' + price + '元')
            }
        } else if (parseFloat(gasoline) == 97) {
            if (litre < 40) {
                price = parseFloat(litre) * 7;
                document.write('汽油7元一升;' + '<br/>');
                document.write('共计:' + price + '元')
            } else {
                price = parseFloat(litre) * 6.5;
                document.write('汽油6.5元一升;' + '<br/>');
                document.write('共计:' + price + '元')
            }
        } else {
            alert("没有此型号的汽油");
        }
    </script>
</body>

</html>